﻿//-----------------------------------------------------------------------
// <copyright file="Exists.cs" company="tuliprules.org">
//     Copyright (c) 2011 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the Exists class.</summary>
//-----------------------------------------------------------------------
namespace Tulip.Rules.Models.Rif.Prd
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents a quantified formula for 'Exists', containing declare and 
    /// formula roles.
    /// </summary>
    [Serializable]
    [DesignerCategory(@"code")]
    [XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2007/rif#")]
    [XmlRoot(Namespace = "http://www.w3.org/2007/rif#", IsNullable = false)]
    public class Exists : Irimeta, IRifPrdElement
    {
        /// <summary>
        /// The declare field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private List<Declare> declareField;

        /// <summary>
        /// The formula field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private Formula formulaField;

        /// <summary>
        /// Initializes a new instance of the <see cref="Exists"/> class. 
        /// </summary>
        public Exists()
        {
            this.declareField = new List<Declare>();
        }

        /// <summary>
        /// Gets or sets a list of declare roles, each containing a Var.
        /// </summary>
        [XmlElement("declare", Order = 0)]
        public List<Declare> Declarations
        {
            get
            {
                return this.declareField;
            }

            set
            {
                this.declareField = value;
            }
        }

        /// <summary>
        /// Gets or sets a formula role, containing a FORMULA.
        /// </summary>
        [XmlElement("formula", Order = 1)]
        public Formula Formula
        {
            get
            {
                return this.formulaField;
            }

            set
            {
                this.formulaField = value;
            }
        }
    }
}
